package com.magicapi.sys.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.magicapi.sys.entity.User;
import com.magicapi.sys.mapper.UserMapper;
import com.magicapi.sys.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
//@DS("slave_1")
@AllArgsConstructor
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    UserMapper userMapper;

    //查所有
    @Override
//    @DS("slave_1")
    public List<User> selectAll() {
        List<User> users = userMapper.selectList(null);
        return users;
    }

    @Override
    @DS("slave_1")
    public List<User> listAll() {
        List<User> list = this.lambdaQuery().list();
        return list;
    }

}
